import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";

Vue.use(VueRouter);
const routes = [
    {
        path: "/",
        component: Home,
        redirect: {name: "home"},
        children: [
            {
                path: "home",
                name: "home",
                component: (resolve) => require(["@/views/DefaultPage"], resolve),
            },
            {
                path: "personInfo",
                name: "personInfo",
                component: (resolve) => require(["@/views/PersonInfo"], resolve),
            },

            {
                path: "personSafe",
                name: "personSafe",
                component: (resolve) => require(["@/views/PersonSafe"], resolve),
            },
            {
                path: "certification",
                name: "certification",
                component: (resolve) => require(["@/views/Certification"], resolve),
            },
            {
                path: "peopleserve",
                name: "peopleserve",
                component: (resolve) => require(["@/views/PeopleServe"], resolve),
            },
            {
                path: "listContent",
                name: "listContent",
                redirect: {name: "mail"},
                component: (resolve) => require(["@/views/ListContent"], resolve),
                children: [

                    {
                        path: "mail",
                        name: "mail",
                        component: (resolve) => require(["@/components/list/Mail"], resolve),
                    },
                    {
                        path: "inspection",
                        name: "inspection",
                        component: (resolve) => require(["@/components/list/Inspection"], resolve),
                    },

                    {
                        path: "suggestions",
                        name: "suggestions",
                        component: (resolve) => require(["@/components/list/Suggestions"], resolve),
                    },

                    {
                        path: "survey",
                        name: "survey",
                        component: (resolve) => require(["@/components/list/Survey"], resolve),
                    },

                    {
                        path: "mycollect",
                        name: "mycollect",
                        component: (resolve) => require(["@/components/list/MyCollect"], resolve),
                    },

                    {
                        path: "mylook",
                        name: "mylook",
                        component: (resolve) => require(["@/components/list/MyLook"], resolve),
                    },

                    {
                        path: "mysubscibe",
                        name: "mysubscibe",
                        component: (resolve) => require(["@/components/list/MySubscibe"], resolve),
                    },
                    {
                        path: "mything",
                        name: "mything",
                        component: (resolve) => require(["@/components/list/MyThing"], resolve),
                    },

                    {
                        path: "webonline",
                        name: "webonline",
                        component: (resolve) => require(["@/components/list/webonline"], resolve),
                    },

                    {
                        path: "myMaterial",
                        name: "myMaterial",
                        component: (resolve) => require(["@/components/list/myMaterial"], resolve),
                    },

                    {
                        path: "myEvaluate",
                        name: "myEvaluate",
                        component: (resolve) => require(["@/components/list/myEvaluate"], resolve),
                    },
                    
                ]
            },
        ],
    },
    {
        path: "/suggestionsDetail",
        name: "suggestionsDetail",
        component: (resolve) => require(["@/views/SuggestionsDetail"], resolve),
    },
    {
        path: "/mailDetail",
        name: "mailDetail",
        component: (resolve) => require(["@/views/MailDetail"], resolve),
    },
    {
        path: "/inspectionDetail",
        name: "inspectionDetail",
        component: (resolve) => require(["@/views/InspectionDetail"], resolve),
    },
    {
        path: "/surveySubmit",
        name: "surveySubmit",
        component: (resolve) => require(["@/views/SurveySubmit"], resolve),
    },
    {
        path: "/surveyResult",
        name: "surveyResult",
        component: (resolve) => require(["@/views/SurveyResult"], resolve),
    },

    {
        path: "/evaluateDetail",
        name: "evaluateDetail",
        component: (resolve) => require(["@/views/evaluateDetail"], resolve),
    },
];

const router = new VueRouter({
    mode: "history",
    base: process.env.NODE_ENV === "production" ? "/usercenter/" : "/",
    routes,
});

export default router;
